package org.example.threadpool;

import lombok.extern.slf4j.Slf4j;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.ThreadFactory;

/**
 * @author zhengdp
 * @Description 测试 singleThreadExecutor
 * @Date 2022/12/11 22:30
 * @Created by zhengdp
 */
@Slf4j(topic = "c.ExecutorTest")
public class ExecutorTest {
    public static void main(String[] args) {
        test2();
    }

    public static void test2() {
        ExecutorService pool  = Executors.newSingleThreadExecutor();
        pool.execute(() ->  {
            log.info("1");
            int i = 1/0;
        });

        pool.execute(() -> {
            log.info("2");
        });

        pool.execute(() -> {
            log.info("3");
        });
    }

}
